﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;


namespace SQLServerOptimizer.PL.WPF
{
    /// <summary>
    /// Interaction logic for SeverityList.xaml
    /// </summary>
    public partial class SeverityList
    {

        public ObservableCollection<Severity> severities = new ObservableCollection<Severity>();
        public SeverityList()
        {

            InitializeComponent();
            severities.Add(new Severity("High", (AutoFixControl.High == 3), new SolidColorBrush(Colors.Black)));
            severities.Add(new Severity("Med", (AutoFixControl.Mid == 2), new SolidColorBrush(Colors.Black)));
            severities.Add(new Severity("Low", (AutoFixControl.Low == 1), new SolidColorBrush(Colors.Black)));
            SeverityLB.ItemsSource = severities;

        }

        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            if (((System.Windows.Controls.CheckBox)(sender)).Tag == "High")
            {
                AutoFixControl.High = 0;
            }
            else if (((System.Windows.Controls.CheckBox)(sender)).Tag == "Med")
            {
                AutoFixControl.Mid =0;
            }
            else if (((System.Windows.Controls.CheckBox)(sender)).Tag == "Low")
            {
                AutoFixControl.Low = 0 ;
            }
            var main = App.Current.MainWindow as MainWindow; // If not a static method, this.MainWindow would work
            main.AutoFix.AutofixControl.RefreshReport();
          
            main.IssueReport.RefreshReport();
        }

        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (((System.Windows.Controls.CheckBox)(sender)).Tag == "High")
            {
                AutoFixControl.High = 3;
            }
            else if (((System.Windows.Controls.CheckBox)(sender)).Tag == "Med")
            {
                AutoFixControl.Mid = 2;
            }
            else if (((System.Windows.Controls.CheckBox)(sender)).Tag == "Low")
            {
                AutoFixControl.Low = 1;
            }
            var main = App.Current.MainWindow as MainWindow; // If not a static method, this.MainWindow would work
            main.AutoFix.AutofixControl.RefreshReport();
      
          
            main.IssueReport.RefreshReport();
        }

    


     
    }
}
